//
//  BaseViewController.m
//  TestAudio
//
//  Created by 悠哉小哥哥 on 2018/7/3.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "BaseViewController.h"
#import <Masonry.h>
#import "ViewController.h"
#import "SoundEffectsVC.h"

@interface BaseViewController ()<UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) NSArray *arr;

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.arr = @[@"音频播放_进度条", @"音效播放"];
    
    UITableView *baseTb = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
    
    baseTb.delegate = self;
    baseTb.dataSource = self;
    
    baseTb.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    
    [self.view addSubview:baseTb];
    
    [baseTb mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.edges.equalTo(self.view);
    }];
    
    
    baseTb.rowHeight = UITableViewAutomaticDimension;
    baseTb.estimatedRowHeight = 60;
    
    
    [baseTb registerClass:[UITableViewCell class] forCellReuseIdentifier:@"id"];
    
    
}



- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return _arr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"id"];
    
    cell.textLabel.text = self.arr[indexPath.row];
    cell.textLabel.textColor = [UIColor orangeColor];
    
    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.row == 0) {
        
        [self.navigationController pushViewController:[[ViewController alloc] init] animated:YES];
        
    }else if (indexPath.row == 1){
        
        [self.navigationController pushViewController:[[SoundEffectsVC alloc] init] animated:YES];
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
